package com.android.hamster.games;

import java.util.List;

import android.graphics.Color;

import com.android.hamster.framework.Game;
import com.android.hamster.framework.Graphics;
import com.android.hamster.framework.Screen;
import com.android.hamster.framework.Input.TouchEvent;

public class Menu extends Screen {
	Graphics graphics;

	public Menu(Game game) {
		super(game);
		graphics = game.getGraphics();
	}

	@Override
	public void update(float deltaTime) {
		List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
		int len = touchEvents.size();
		for (int i = 0; i < len; i++) {
			TouchEvent event = touchEvents.get(i);
			if (event.type == TouchEvent.TOUCH_UP) {

				if (event.x < 160) { // LEFT SIDE OF MENU

					if (event.y < 100) {
						game.setScreen(new SampleScreen(game));
					}
					if (event.y > 100 && event.y < 200) {
						// game.setScreen(new YourGameHere(game));
					}
					if (event.y > 200 && event.y < 300) {
						// game.setScreen(new YourGameHere(game));
					}
					if (event.y > 300 && event.y < 400) {
						// game.setScreen(new YourGameHere(game));
					}

				}// LEFT SIDE OF MENU

				if (event.x > 160) {// RIGHT SIDE OF MENU

					if (event.y < 100) {
						game.setScreen(new BoxGameScreen(game));
					}
					if (event.y > 100 && event.y < 200) {
						// game.setScreen(new YourGameHere(game));
					}
					if (event.y > 200 && event.y < 300) {
						// game.setScreen(new YourGameHere(game));
					}
					if (event.y > 300 && event.y < 400) {
						// game.setScreen(new YourGameHere(game));
					}
				}// RIGHT SIDE OF MENU

			}
		}
		// game.setScreen(new BoxGameScreen(game));

	}

	@Override
	public void present(float deltaTime) {

		graphics.drawBackground(Color.BLACK);

		graphics.drawLine(160, 0, 160, 480, Color.DKGRAY);
		graphics.drawLine(0, 100, 320, 100, Color.DKGRAY);
		graphics.drawLine(0, 200, 320, 200, Color.DKGRAY);
		graphics.drawLine(0, 300, 320, 300, Color.DKGRAY);
		graphics.drawLine(0, 400, 320, 400, Color.DKGRAY);

		graphics.drawText("Sample", 80, 60, 22, Color.RED);
		graphics.drawText("BoxGame", 240, 60, 22, Color.CYAN);
		graphics.drawText("???????", 80, 160, 22, Color.GREEN);
		graphics.drawText("???????", 240, 160, 22, Color.MAGENTA);
		graphics.drawText("???????", 80, 260, 22, Color.YELLOW);
		graphics.drawText("???????", 240, 260, 22, Color.LTGRAY);
		graphics.drawText("???????", 80, 360, 22, Color.WHITE);
		graphics.drawText("???????", 240, 360, 22, Color.BLUE);

	}

	@Override
	public void pause() {

	}

	@Override
	public void resume() {
	}

	@Override
	public void dispose() {
	}

}
